home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
wtek0693.zip
/
OOPALLEY.ZIP
/
RANDOM.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-04-27
|
615b
|
27 lines
#include "random.h"
#include "oopsconfig.h"
#include <time.h>
#define THIS Random
#define BASE Object
DEFINE_CLASS(Random,Object);
//Random::Random() { randx = time(&randx); randx ^= (long)this; }
Random::Random() { randx = time((time_t *)&randx); randx ^= (long)this; }
float Random::next() const
{
/*register*/ float temp;
do temp = DRAW(randx)/(float)MAX_INT; while (temp==0);
return temp;
}
Object* Random::copy() const { return shallowCopy(); }
void Random::deepenShallowCopy() {}
void Random::printOn(ostream& strm) const
{
strm << randx;
}